<link rel="stylesheet" href="/css/topicApps.css">
<style>
.nothing {
	display: inline-block;
    height: 100px;
    line-height: 80px;
}
 .content-main {
    width: calc( 100% - 43px );
    height: auto;
    padding: 25px 19px 15px 24px;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.30);
	box-shadow: 0 2px 8px 0 rgba(0,0,0,0.26);
	border-radius: 2px;
 }
 .content-main .fly-list .fly-list-li {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 0;
    margin-bottom: 12px;
}
.content-main .fly-list .fly-list-li:hover {
    background-color: #fff;
}
.padding-left15 {
    padding-left: 15px!important;
    height: 33px!important;
}
.padding-left15 h2 {
    width: 440px;
    display: inline-block;
    vertical-align: top;
}
.padding-left15 p {
    display: inline-block;
    float: right;
}
.padding-left15 p span,
.padding-left15 p span a {
    color: #000!important;
    margin-left: 10px;
}
.padding-left15 span.red-price {
    color: red;
    display: inline-block;
    vertical-align: top;
    width: 60px;
}
.padding-left15 span.time {
    display: inline-block;
    vertical-align: top;
    width: 100px;
}
.padding-left15 span.author {
    display: inline-block;
    vertical-align: top;
    width: 75px;
}
</style>
<div class="main layui-clear">
	<div class="wrap layui-clear">
		<div class="layui-left">
		    <div class="layui-bar">
		    	<div class="layui-breadcrumbs">
		    		<a class="home" href="/"></a>
			  		<i class="layui-icon">&#xe602;</i>
			  		<a href="#">搜索</a>
		    	</div>
		    </div>
		    <div class="content" style="margin-right:0px;">
		    	<div class="content-main">
				      <ul class="fly-list">
				      	<#if searchList??>
				      	<#list searchList.content as topic>
				      	 <#if searchtype?contains("帖子") >
				        <li class="fly-list-li">
				       	 <#if topic.username == user.username>
				          <a href="/user/profile.html" class="fly-list-avatar">
				            <img src="/${user.fileurl!''}"  onerror="this.src='/images/user/default.jpg';this.onerror=null">
				          </a>
				          <#else>
				          	<a href="/user/otherUser/${topic.creater}.html" target="_blank" class="fly-list-avatar">
					            <img src="/${topic.user.fileurl!''}"  onerror="this.src='/images/user/default.jpg';this.onerror=null">
					          </a>
				          </#if>
				          <h2 class="fly-tip">
				          <#if topic.block.blockname??>
				            <label class="tip-type">
				            	<#if (topic.block.blockname?length > 5)>
				            		<label title="${topic.block.blockname!''}">${topic.block.blockname[0..4]?default("")}</label>
				            	<#else>
				            	 	${topic.block.blockname!''}
				            	</#if>
				            </label>
				           </#if>
				            <a title="${topic.title!''}" href="/topic/detail/${topic.id!''}.html">${topic.title!''}</a>
				            <#if topic.top =="true">
				            	<span class="topic-tip top"></span>
				            </#if>
				            <#if topic.essence == "true">
				            	<span class="topic-tip essence"></span>
				            </#if>
				            <#if topic.enclosure == "true">
				            	<span class="topic-tip file"></span>
				            </#if>
				          </h2>
				          <p>
				          	<span>
				          	<#if topic.username == user.username>
				          	<a href="/user/profile.html">
				          	<#else>
				          	<a href="/user/otherUser/${topic.creater}.html" target="_blank">
				          	</#if>
				          	${topic.username!''}
				          	</a>
				          	<#if topic.username != user.username>
					          <a class="show-user-msg">
						          	<span title="${topic.username!''}" class="title"  onclick="window.open('/user/otherUser/${topic.user.id}.html')">${topic.username!''}</span>
						          	<#if topic.user.usertype=="0"><span class="grade">( 管理员 )</span><br>
						          	<#else>
						          		<span class="grade">( lv${topic.user.grade.grade!''}.${topic.user.grade.groups!''} )</span><br>
						          	</#if>
						          	<span class="memo">${topic.user.memo!''}</span><br>
						          	<#if user??>
							          	<#if topic.user.fansIs =="No">
							          		<span id="followsB${topic.user.id!''}" class="follow" onclick="fans('${topic.user.id!''}')"><span class="topic-follow-tip"></span><b>关注</b></span>
										<#else>
											<span id="followsB${topic.user.id!''}" class="follow" onclick="unfans('${topic.user.id!''}')"><span class="topic-follow-tip"></span><b>已关注</b></span>
										</#if>
									<#else>
							          	<span id="followsB${topic.user.id!''}" class="follow" onclick="window.location.href = '/login'"><span class="topic-follow-tip"></span><b>关注</b></span>
						          	</#if>
						          	<span class="messageBoade" onclick="window.open('/messageboard/otherIndex/${topic.user.id!''}.html')"><span class="topic-mess-tip"></span>留言</span>
					        	</a>
				          	</#if>
				          	</span>
				          	<span class="cut-off">|</span>
				            <span><#if searchtype=="帖子">${topic.updatetime?string('yyyy/MM/dd HH:mm')}<#else>${topic.releasetime?string("yyyy-MM-dd")}</#if></span>
				             <#if searchtype?contains("帖子") >
				            	<span class="cut-off">|</span>
					            <span>回复 ${topic.answers!0}</span><span class="cut-off">|</span>
					            <span>浏览 ${topic.views!0}</span>
					          </#if>
				          </p>
				          <#if topic.finish==true>
				          	<span class="stick"></span>
				          </#if>
				        </li>
				        <#elseif searchtype?contains("案例") >
				        <li class="fly-list-li padding-left15">
						  <h2 class="fly-tip">
			            	<a title="${topic.title!''}" href="/admin/microcase/hotDetail/${topic.id!''}.html?id=${topic.id!''}">${topic.title!''}</a>
				          	<#if topic.essencecase =="1"><span class="topic-tip essence"></span></#if>
				          </h2>
				          	<span title="${topic.author!''}" class="author layui-elip">${topic.author!''}</span>
				          	<#if topic?? && topic.price?string('')=='0'>
								<span class="red-price">免费</span>
							<#else>
								<span class="red-price">￥&nbsp;${topic.price?string('0.00')}</span>
							</#if>
				            <span class="time">${topic.releasetime?string("yyyy-MM-dd")}</span>
				        </li>
				        <#else>
				        <li class="fly-list-li padding-left15">
						  <h2 class="fly-tip">
			          		<a title="${topic.title!''}" href="/admin/informationdisplay/hotDetail/${topic.id!''}.html?id=${topic.id!''}">${topic.title!''}</a>
				          </h2>
				          <p>
				          	<span>
				          	<#if topic.username == user.username>
				          	<a href="/user/profile.html">
				          	<#else>
				          	<a href="/user/otherUser/${topic.creater}.html" target="_blank">
				          	</#if>${topic.user!''}
				          	</a>
				          	</span>
				            <span>${topic.releasetime?string("yyyy-MM-dd")}</span>
				          </p>
				        </li>
				        </#if>
				        </#list>
				        <#if searchList.content?size==0>
				        	<span class="nothing">没有查询到相关信息.......</span>
				        </#if>
				        </#if>
				      </ul>
		    	</div>
		    	<div style="text-align: center" class="front-desk">
		          <div class="laypage-main" id="pages"></div>
		        </div>
		    </div>
	    </div>
	    <div class="layui-right">
	    	<div class="right-edge">
		        <div class="recommend-section">
		        	<span class="text">推荐板块<br><span class="text-line">RECOMMEND</span></span>
		        </div>
		        <div class="plate-list">
			        <#if blockList??>
					<#list blockList as block>
						<#if block.type=="板块">
							<a onclick="searchHref('','${block.id!''}','${RequestParameters['q']!''}','topicIndex')"  class="layui-clear">
								<div class="card-list <#if block.id==cateparent>this </#if>">
				        			<span class="class"><img alt="" src="/res/blockmanagement/${block.fileurl!''}.html"></span>
				        			<span  title="${block.blockname!''}"  class="class-title">${block.blockname!''}</span>
				        		</div>
							</a>
						</#if>
					</#list>
					</#if>
		        </div>
		    </div>
	    </div>
	  	<div style="clear: both"></div>
	  </div>
  </div>
  <script>
  	layui.use(['laypage', 'layer'], function(){
  		var laypage = layui.laypage;
	  	laypage({
		    cont: 'pages'
		    ,first:'首页'
		    ,last:'末页'
		    ,pages: ${searchList.totalPages}
		    ,curr:${searchList.number+1}
		    ,skin: '#32c24d'
		    ,skip: true
		    ,jump:function(obj, first){
		    	var curr = obj.curr;
		    	if(!first){
		               location.href = '/topic/searchIndex?searchtype=${searchtype}&q=${key}&p=' + curr + "<#if RequestParameters['q']?? && RequestParameters['q'] != ''>&q=${RequestParameters['q']}</#if>";
		    	}
		    }
		});
	});
  	
  	function fans(id){
  		$.ajax({
  	        type: "POST",
  	        url: "/user/fans/"+id,
  	        data: {},
  	        success: function(data){
  	        	if(data == "success"){
  	        		$("#followsB"+id+" b").text("已关注");
  	        		$("#followsB"+id).attr("onclick","unfans('"+id+"')");
  	        		layer.msg('关注成功', {icon: 1});
  	        	}else{
  	        		layer.msg('关注失败', {icon: 2});
  	        	}
  	        }
  	    });
  	}
  	function unfans(id){
  		$.ajax({
  	        type: "POST",
  	        url: "/user/unfans/"+id,
  	        data: {},
  	        success: function(data){
  	        	if(data == "success"){
  	        		$("#followsB"+id+" b").text("关注");
  	        		$("#followsB"+id).attr("onclick","fans('"+id+"')");
  	        		layer.msg('取消关注成功', {icon: 1});
  	        	}else{
  	        		layer.msg('取消关注失败', {icon: 2});
  	        	}
  	        }
  	    });
  	}
  </script>